<template>
    <div class="rn-auth-cotianer">
        <div class="user-info-item1">
            <div class="user-group">
                <div class="user-item1">
                    <div class="ui-first-item">
                        真实姓名
                    </div>
                    <div class="ui-last-item">
                        {{realname}}
                    </div>
                </div>
                <div class="user-item1">
                    <div class="ui-first-item">
                        身份证号码
                    </div>
                    <div class="ui-last-item">
                        {{id_cardno}}
                    </div>
                </div>
                <div class="user-item1">
                    <div class="ui-first-item">
                        结算银行卡
                    </div>
                    <div class="ui-last-item">
                        {{bank_cardno}}
                    </div>
                </div>
                <div class="user-item1">
                    <div class="ui-first-item">
                        预留手机号
                    </div>
                    <div class="ui-last-item">
                        {{phone}}
                    </div>
                </div>
                <div class="user-item1">
                    <div class="ui-first-item">
                        银行信息
                    </div>
                    <div class="ui-last-item">
                        {{bank_name}}
                    </div>
                </div>
                <div class="user-item1">
                    <div class="ui-first-item">
                        审核状态
                    </div>
                    <div class="ui-last-item new-font">
                        {{state}}
                    </div>
                </div>
                <div class="clearfix"></div>
            </div>
        </div>
    </div>
</template>
<script>
export default {
  data() {
    return {
      realname: "",
      id_cardno: "",
      bank_cardno: "",
      phone: "",
      bank_name: "",
      state: ""
    };
  },
  created() {
    let that = this;
    that._load();
  },
  methods: {
    //加载
    _load() {
      let that = this;
      that.$api.ajax([that._getUserInfo()]);
    },
    // 获取用户信息
    _getUserInfo() {
      let that = this;
      let params = {
        openid: that.$storage.get("openid")
      };
      return new Promise(function(resolve, reject) {
        that.$api
          .getUserInfo(params)
          .then(res => {
            console.log("----打印用户信息----")
            console.log(res)
            if (res.RCD == 0) {
              that.realname = res.realname
              that.id_cardno = res.id_cardno.substring(0, 14) + "****"
              that.bank_cardno =res.bank_cardno.substring(0, res.bank_cardno.length - 4) +"****"
              that.bank_name = res.bank_name
              let reg = new RegExp("(\\d{3})(\\d{4})(\\d{4})")
              that.phone = res.phone.replace(reg, "$1****$3")
              if (res.state == 0) {
                that.state = "未审核"
              } else if (res.state == 1) {
                that.state = "正常"
              } else if (res.state == 2) {
                that.state = "停用"
              }
            } else {
              that.$totast(res.ErrMsg)
            }
            resolve()
          })
          .catch(err => {
            resolve()
          });
      });
    }
  }
};
</script>
<style lang="less" scoped>
.rn-auth-cotianer {
  width: 100%;
  height: 100vh;
  background-color: #f5f5f5;
  .user-info-item1 {
    padding-top: 8%;
  }
  .user-group {
    width: 100%;
    background-color: #fff;
    .user-item1 {
      width: 96%;
      float: right;
      border-bottom: 1px solid #f5f5f5;
      .line-heigt(11vw);
    }
    .ui-first-item {
      float: left;
    }
    .ui-last-item {
      width: 64vw;
      float: right;
      color: #c8c8c8;
      input {
        width: 100%;
        .line-heigt(9vw);
        border: 0;
      }
    }
    .new-font {
      color: #fe6d0a;
    }
  }
  .line-heigt(@height) {
    height: @height;
    line-height: @height;
  }
}
</style>
